using System;
using System.Collections.Generic;
using System.Text;

namespace GAscheduler
{
    /// <summary>
    /// Contains some time period, and some class room, to be matched with a course
    /// </summary>
    class Gene
    {
        //Array indexes into periods and rooms
        public int period;
        public int room;
        public int course;

        /// <summary>
        /// Return the course #
        /// </summary>
        /// <returns></returns>
        public string getCourse()
        {
            return CourseManager.get(course).Subject + CourseManager.get(course).CourseNum;
        }

        /// <summary>
        /// Return the room # cat'ed with the building
        /// </summary>
        /// <returns></returns>
        public string getRoom()
        {
            Room r = RoomManager.get(room);
            return r.Building + r.RoomNumber;
        }

        public string getSubject()
        {
            return CourseManager.get(course).Subject;
        }

        public string getBuilding()
        {
            return RoomManager.get(room).Building;
        }

        /// <summary>
        /// Instantiate specific values for memeber data
        /// </summary>
        public Gene(Gene gene)
        {
            this.period = gene.period;
            this.room = gene.room;
            this.course = gene.course;
        }

        /// <summary>
        /// Instantiate random values for member data
        /// </summary>
        public Gene(int course)
        {
            //TODO: There is a chance that rethinking randomness would help, but this is low priority.
            this.period = new Random().Next(PeriodManager.Length());//Periods class has static member length
            this.room = new Random().Next(RoomManager.Length());//Rooms class has static member length
            this.course = course;
        }
    }
}
